var Undertaker = require('undertaker');
var taker = new Undertaker();
taker.task('step1', (cb) => {
	console.log('Shell step1');
	cb(null, 'step1');
});
taker.task('step2', (cb) => {
	return new Promise((resolve, reject) => {
		console.log('Shell step2');
		resolve('step2');
		// reject();
	});
});
taker.task('step3', taker.series(['step1', 'step2'], (cb) => {
	console.log('Shell step3');
	cb(null, 'step3');
}));

taker.on('error', (error)=>{
	console.log('Shell error', error);
	process.exit(1);
});

console.log('### 开始执行任务 ###');
taker.series('step3')((error, preResult)=>{
	console.log('### 结束任务流程 ###');
	// 这里是两层数组，奇特吧？补齐特~ 可以执行多个任务
	console.log('preResult', preResult);
});
